package hotel;

import java.util.ArrayList;

public class Owner 
{
	private String name;
	private String password;
	private ArrayList<Hotel> hotels; 
	
	public Owner(String inName, String inPass){
		hotels = new ArrayList<Hotel>();
		name = inName;
		password = inPass;
	}
	
	public String getName() {
		return name;
	}

	public String getPassword() {
		return password;
	}

	public ArrayList<Hotel> getHotels() {
		return hotels;
	}

	public boolean addHotel(Hotel inHotel){
		for(int i = 0; i < hotels.size(); i++)
			if(hotels.get(i).getName().equals(inHotel.getName()))
				return false;
		hotels.add(inHotel);
		loginWindow.database.addHotel(inHotel);
		return true;
	}
	
	public boolean removeHotel(String inHotel)
	{
		for(int i = 0; i < hotels.size(); i++)
		{
			if(hotels.get(i).getName().equals(inHotel))
			{
				loginWindow.database.removeHotel(hotels.get(i));
				hotels.remove(i);
				return true;
			}
		}
		return false;
	}
	
}
